import {InitInformation} from "./DataRendering.js"

// 显示控制函数
function hideAllForms() {
    document.getElementById('userInfo').style.display = 'none';
    document.getElementById('changePasswordForm').style.display = 'none';
    document.getElementById('changeEmailForm').style.display = 'none';
    document.getElementById('changeUsernameForm').style.display = 'none';
    document.getElementById('editIntroductionForm').style.display = 'none';
    document.getElementById('changeAvatarForm').style.display = 'none';
}

// 事件监听器
// 切换 到 展视用户信息
document.getElementById('showIntroduction').addEventListener('click', () => {
    hideAllForms();

    document.getElementById('userInfo').style.display = 'block';
    InitInformation();

});
//切换 到 修改密码
document.getElementById('changePassword').addEventListener('click', () => {
    hideAllForms();
    document.getElementById('changePasswordForm').style.display = 'block';
});
//切换 到 修改 邮箱
document.getElementById('changeEmail').addEventListener('click', () => {
    hideAllForms();
    document.getElementById('changeEmailForm').style.display = 'block';
});
//切换 到 修改 用户名
document.getElementById('changeUsername').addEventListener('click', () => {
    hideAllForms();
    document.getElementById('changeUsernameForm').style.display = 'block';
});
//切换 到 编辑简介
document.getElementById('editIntroduction').addEventListener('click', () => {
    hideAllForms();
    document.getElementById('editIntroductionForm').style.display = 'block';
});
// 切换 到 更改头像
document.getElementById('changeAvatar').addEventListener('click', () => {
    hideAllForms();
    document.getElementById('changeAvatarForm').style.display = 'block';
});